var AJXReload = {

script:  false,
objid:   false,
timeout: false,
request: false,


init:function (script, objid, timeout) {
    this.script =script;
    this.timeout=timeout;
    this.objid  =document.getElementById(objid);
    this.request=this.createRequestObject();
},

start:function (script, objid, timeout) {
    this.init(script, objid, timeout);
    this.getcontent();
},

getcontent:function () {
    if (this.request) {
	var par = (this.script.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime();

        this.request.open("GET", this.script + par, true);
        this.request.onreadystatechange = function(){ AJXReload.iniProgressResponse(); };
        this.request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        this.request.send(null);
    }
},

createRequestObject:function(){
    var req = false;

    if(window.XMLHttpRequest)
    {
        req = new XMLHttpRequest();
//      if (req.overrideMimeType)
//    	    req.overrideMimeType('text/xml'); 
    }
    else if(window.ActiveXObject)
    {
        try {
    	    req = new ActiveXObject("Msxml2.XMLHTTP"); 
    	}
        catch(e) 
        {
            try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){}
        }
    }

    return req ? req : false;
},

// Initialize the progress bar
iniProgressResponse:function () {
    if (this.request.readyState == 4)
    {
        if(this.request.status == 200)
        {
	    this.objid.innerHTML=this.request.responseText;
        }
        else
        {
            // ERROR 
        }

	if (this.timeout)
    	    self.setTimeout("AJXReload.getcontent()", this.timeout); 
    }
},


handleKey:function(event) {
    if (document.all)
    { if(window.event.keyCode == 13) return false;  }
    else
    { if(event && event.which == 13) return false;  }
}

}
